package com.kele.es_project.api;

/**
 * @author Shanks
 * @date 2020-03-29
 */
public class AssertException extends RuntimeException {

    private static final long serialVersionUID = 1183781048232927363L;

    private int code = 400;
    private String message;

    public AssertException(String message) {
        super(message);
        this.message = message;
    }

    public AssertException(String message, Throwable e) {
        super(message, e);
        this.message = message;
    }

    public AssertException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public AssertException(int code, String message, Throwable e) {
        super(message, e);
        this.code = code;
        this.message = message;
    }

    public AssertException(ErrorCode e) {
        super(e.getMessage());
        this.code = e.getCode();
        this.message = e.getMessage();
    }

    private AssertException() {}

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}